from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
import time
d = webdriver.Chrome()
d.maximize_window()
d.get('https://mail.163.com/')
time.sleep(3)

# 1.先定位到所处的frame标签 或者 iframe标签
ele = d.find_element(By.CSS_SELECTOR,'[scrolling="no"]')
# 2. 切换过去swith_to.frame(表单定位)，切换过去之后就只能操作该表单中的元素了
d.switch_to.frame(ele)
time.sleep(2)
# 定位用户名输入框，输入内容
user = d.find_element(By.CSS_SELECTOR,'[name="email"]')
user.send_keys('admin123')
time.sleep(3)
# 如果操作表单之外的元素，跳出表单 switch_to.default_content() 调到最外层
d.switch_to.default_content()
vip = d.find_element(By.LINK_TEXT,'VIP')
vip.click()
time.sleep(3)



time.sleep(40)
d.quit()